package com.xul.srb.sms.controller.api;

import com.xul.common.result.Result;
import com.xul.srb.sms.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author xul
 * @create 2022-07-14 23:13
 */

@RestController
@RequestMapping("/api/sms")
@Api(tags = "短信管理")
// @CrossOrigin
@Slf4j
public class ApiSmsController {

    @Resource
    private SmsService smsService;

    @ApiOperation("发送短信")
    @GetMapping("/send/{mobile}")
    public Result send(@ApiParam(value = "手机号", required = true)
                       @PathVariable String mobile) {
        smsService.send(mobile);
        return Result.ok().message("短信发送成功");
    }
}
